package com.virtualCat.dao;

import com.virtualCat.entity.PayOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface PayOrderDao {
    @Insert("insert into t_payorder(orderid,openid,catid,total_fee,good_body,create_time,status) " +
            "values(#{orderid},#{openid},#{catid},#{total_fee},#{good_body},#{create_time},#{status})")
    int insert(PayOrder payOrder);

    @Select("select * from t_payorder where orderid=#{order_id}")
    PayOrder findById(@Param("order_id")String order_id);

    @Update("update t_payorder set status=#{status} where orderid=#{order_id}")
    int update(@Param("status")int status,@Param("order_id")String order_id);

    @Select("select count(1) from t_payorder where orderid=#{orderid}")
    int selectById(String openid);
}
